const Controller = require('egg').Controller;

class ProductController extends Controller {
  //类型详情
  async detail() {
    const { ctx } = this;
    try {
      let { id } = ctx.request.body;
      let list = await this.service.product.getDetail(id)
      ctx.response.body = {
        code: 1,
        data: list
      }

    } catch (e) {
      ctx.response.body = {
        code: 0,
        msg: e.message
      }
    }
  }
  //订单提交
  async addProduct(){
    try{
      console.log(this.ctx.request.body)
      let result = await this.ctx.service.product.addroduct(this.ctx.request.body)
      this.ctx.response.body=result
    }catch(e){
      this.ctx.response.body={
        code:0,
        msg:e.message
      }
    }
  }
}

module.exports = ProductController;